import os
import sys
import re

if __name__ == '__main__':
    handler = sys.stdin   # 系统标准输入
    word_dict = {}  # 定义个空字典
    for line in handler:  # 逐列读取
        if not line:
            continue
        terms = line.strip().split(" ")  # 空格分隔
        for i in terms: # 读取每列
            if i in word_dict:    # 看看在不在字典里，
                word_dict[i] += 1  # 如果在就+1
            else:
                word_dict[i] = 1  # 如果不在就设置为1

    for j in word_dict: # 遍历
        print(j, word_dict[j])  # 输出

